# tuple
# 声明元组
t = (1, 2, 3)
print(t, type(t))  # (1, 2, 3) <class 'tuple'>

# 省略括号声明元组
t = 1, 2, 3
print(t, type(t))  # (1, 2, 3) <class 'tuple'>

# 空元组
t = ()
print(t, type(t))  # () <class 'tuple'>

# 单个元素元组,必须有逗号
t = 41,
print(t, type(t))
t = (41,)
print(t, type(t))  # (41,) <class 'tuple'>
t = (41)
print(t, type(t))  # 41 <class 'int'>

#
t = 3 * (40 + 2,)
print(t)  # (42, 42, 42)

#
t = tuple([1, 2, 3])
print(t)  # (1, 2, 3)
print(tuple('abc'))  # ('a', 'b', 'c')
print(tuple((1, 2, 3)))  # (1, 2, 3)

#
x = 1, 2, 3
print(x[0])  # 1
print(x[0:2])  # (1, 2)

